#ifndef HTTPMANAGER_H
#define HTTPMANAGER_H
#include <QJsonObject>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QString>
#include <QUrl>
#include "global.h"
#include "signleton.h"
class HttpManager : public QObject,
                    public Signleton<HttpManager>,
                    public std::enable_shared_from_this<HttpManager>
{
    Q_OBJECT
    friend class Signleton<HttpManager>;

private:
    HttpManager();
    QNetworkAccessManager _manager;

public:
    void PostHttpReq(QUrl url, QJsonObject &json, ReqId id, Modules mod);
private slots:
    void slot_http_finish(ReqId id, QString res, ErrorCode ec, Modules mod);
signals:
    void sig_http_finish(ReqId id, QString res, ErrorCode ec, Modules mod);
    void sig_reg_mod_finish(ReqId id, QString res, ErrorCode ec);
    void sig_reset_mod_finish(ReqId id, QString res, ErrorCode ec);
    void sig_login_mod_finish(ReqId id, QString res, ErrorCode ec);

public:
    ~HttpManager();
};

#endif // HTTPMANAGER_H
